package com.kzd.btgame.main.mine

import android.view.LayoutInflater
import com.kzd.btgame.R
import com.kzd.btgame.databinding.ActivityMessageDetailsBinding
import com.kzd.btgame.entity.UserMessage
import com.kzd.btgame.jetpack.vm.MineViewModel
import com.kzd.btgame.main.KEY_MESSAGE_ENTITY
import com.module.lemlin.app.OwnerStatusBar
import com.module.lemlin.owner.OwnerViewBindingActivity
import com.module.lemlin.owner.ownerViewModel

class MessageDetailsActivity : OwnerViewBindingActivity<ActivityMessageDetailsBinding>() {

    private val mUserMessage: UserMessage? by lazy {
        intent?.extras?.getSerializable(KEY_MESSAGE_ENTITY) as? UserMessage
    }

    override val inflate: (LayoutInflater) -> ActivityMessageDetailsBinding
        get() = ActivityMessageDetailsBinding::inflate

    override fun initStatusBar(statusBar: OwnerStatusBar) {
        statusBar.run {
            addView = mViewBinding.fMessageDetailsBar
            barColor = R.color.white
        }
        super.initStatusBar(statusBar)
    }

    override fun initView() {
        mUserMessage?.let { fillData(it) }
    }

    private fun fillData(userMessage: UserMessage) {
        mViewBinding.tvMessageDetailsName.text = userMessage.name
        mViewBinding.tvMessageDetailsTime.text = userMessage.time
        mViewBinding.tvMessageDetailsContent.text = userMessage.content
    }

}